% engine=luatex
% \ctxlua{fonts.collections.trace = true}
\let\synchronizetext\relax
\synchronizemathfontsfalse

\spaceskip .25em plus .25em \relax

\definefontfeature[zh][mode=node,script=hang,lang=zhs]

\starttypescript [serif] [zhfont]
    \definefontsynonym
	[ZhSerif][name:AdobeSongStd-Light][features=zh]
    \definefontsynonym
	[ZhSerifBold][name:AdobeHeitiStd-Regular][features=zh]
    \definefontsynonym
	[ZhSerifItalic][name:AdobeKaitiStd-Regular][features=zh]
    \definefontsynonym 
	[ZhSerifBoldItalic][name:AdobeHeitiStd-Regular][features=zh]
    \definefontsynonym
	[ZhSerifSlanted][name:AdobeKaitiStd-Regular][features=zh]
    \definefontsynonym 
	[ZhSerifBoldSlanted][name:AdobeHeitiStd-Regular][features=zh]

    \definefontfallback
	[WesternSerif][name:TeXGyrePagella-Regular][0x0000-0x0400][force=yes]
    \definefontfallback
	[WesternSerifBold][name:TeXGyrePagella-Bold][0x0000-0x0400][force=yes]
    \definefontfallback
	[WesternSerifItalic][name:TeXGyrePagella-Italic][0x0000-0x0400][force=yes]
    \definefontfallback
	[WesternSerifBoldItalic][name:TeXGyrePagella-BoldItalic][0x0000-0x0400][force=yes]
    \definefontfallback
	[WesternSerifSlanted][name:TeXGyrePagella-Italic][0x0000-0x0400][force=yes]
    \definefontfallback
	[WesternSerifBoldSlanted][name:TeXGyrePagella-BoldItalic][0x0000-0x0400][force=yes]
 
   \definefontsynonym 
	[Serif][ZhSerif][fallbacks=WesternSerif]
    \definefontsynonym
	[SerifBold][ZhSerifBold][fallbacks=WesternSerifBold]
    \definefontsynonym
	[SerifItalic][ZhSerifItalic][fallbacks=WesternSerifItalic]
    \definefontsynonym
	[SerifBoldItalic][ZhSerifBoldItalic][fallbacks=WesternSerifBoldItalic]
    \definefontsynonym
	[SerifSlanted][ZhSerifSlanted][fallbacks=WesternSerifSlanted]
    \definefontsynonym
	[SerifBoldSlanted][ZhSerifBoldSlanted][fallbacks=WesternSerifBoldSlanted]
\stoptypescript

\starttypescript [sans][zhfont]
    \definefontsynonym 
	[ZhSans][name:AdobeKaitiStd-Regular][features=zh]
    \definefontsynonym
	[ZhSansBold][name:AdobeHeitiStd-Regular][features=zh]
    \definefontsynonym
	[ZhSansItalic][name:AdobeKaitiStd-Regular][features=zh]
    \definefontsynonym
	[ZhSansBoldItalic][name:AdobeHeitiStd-Regular][features=zh]
    \definefontsynonym
	[ZhSansSlanted][name:AdobeKaitiStd-Regular][features=zh]
    \definefontsynonym
	[ZhSansBoldSlanted][name:AdobeHeitiStd-Regular][features=zh]

    \definefontfallback
	[WesternSans][name:TeXGyreAdventor-Regular][0x0000-0x0400][force=yes]
    \definefontfallback
	[WesternSansBold][name:TeXGyreAdventor-Bold][0x0000-0x0400][force=yes]
    \definefontfallback
	[WesternSansItalic][name:TeXGyreAdventor-Italic][0x0000-0x0400][force=yes]
    \definefontfallback
	[WesternSansBoldItalic][name:TeXGyreAdventor-BoldItalic][0x0000-0x0400][force=yes]
    \definefontfallback
	[WesternSansSlanted][name:TeXGyreAdventor-Italic][0x0000-0x0400][force=yes]
    \definefontfallback
	[WesternSansBoldSlanted][name:TeXGyreAdventor-BoldItalic][0x0000-0x0400][force=yes]

    \definefontsynonym
	[Sans][ZhSans][fallbacks=WesternSans]
    \definefontsynonym
	[SansBold][ZhSansBold][fallbacks=WesternSansBold]
    \definefontsynonym
	[SansItalic][ZhSansItalic][fallbacks=WesternSansItalic]
    \definefontsynonym
	[SansBoldItalic][ZhSansBoldItalic][fallbacks=WesternSansBoldItalic]
    \definefontsynonym
	[SansSlanted][ZhSansSlanted][fallbacks=WesternSansSlanted]
    \definefontsynonym
	[SansBoldSlanted][ZhSansBoldSlanted][fallbacks=WesternSansBoldSlanted]
\stoptypescript

\starttypescript [mono][zhfont]
    \definefontsynonym 
	[ZhMono][name:AdobeFangsongStd-Regular][features=zh]
    \definefontsynonym
	[ZhMonoBold][name:AdobeHeitiStd-Regular][features=zh]
    \definefontsynonym
	[ZhMonoItalic][name:AdobeFangsongStd-Regular][features=zh]
    \definefontsynonym
	[ZhMonoBoldItalic][name:AdobeHeitiStd-Regular][features=zh]
    \definefontsynonym
	[ZhMonoSlanted][name:AdobeFangsongStd-Regular][features=zh]
    \definefontsynonym
	[ZhMonoBoldSlanted][name:AdobeHeitiStd-Regular][features=zh]

    \definefontfallback
	[WesternMono][name:TeXGyreCursor-Regular][0x0000-0x0400][force=yes]
    \definefontfallback
	[WesternMonoBold][name:TeXGyreCursor-Bold][0x0000-0x0400][force=yes]
    \definefontfallback
	[WesternMonoItalic][name:TeXGyreCursor-Italic][0x0000-0x0400][force=yes]
    \definefontfallback
	[WesternMonoBoldItalic][name:TeXGyreCursor-BoldItalic][0x0000-0x0400][force=yes]
    \definefontfallback
	[WesternMonoSlanted][name:TeXGyreCursor-Italic][0x0000-0x0400][force=yes]
    \definefontfallback
	[WesternMonoBoldSlanted][name:TeXGyreCursor-BoldItalic][0x0000-0x0400][force=yes]

    \definefontsynonym
	[Mono][ZhMono][fallbacks=WesternMono]
    \definefontsynonym
	[MonoBold][ZhMonoBold][fallbacks=WesternMonoBold]
    \definefontsynonym
	[MonoItalic][ZhMonoItalic][fallbacks=WesternMonoItalic]
    \definefontsynonym
	[MonoBoldItalic][ZhMonoBoldItalic][fallbacks=WesternMonoBoldItalic]
    \definefontsynonym
	[MonoSlanted][ZhMonoSlanted][fallbacks=WesternMonoSlanted]
    \definefontsynonym
	[MonoBoldSlanted][ZhMonoBoldSlanted][fallbacks=WesternMonoBoldSlanted]
\stoptypescript

\starttypescript[myfont]
    \definetypeface[myfont][rm][serif][zhfont]
    \definetypeface[myfont][ss][sans][zhfont]
    \definetypeface[myfont][tt][mono][zhfont]
\stoptypescript
